package com.endurance.handler;

import com.endurance.handler.impl.BlacklistHandler;

public abstract class GatewayHandler {

    protected GatewayHandler nextGatewayHandler;

    /**
     * 使用抽象类定义共同方法的行为
     */
    public abstract void service();

    /**
     * 执行下一个handler
     */
    public void nextService() {
        if (nextGatewayHandler != null) {
            nextGatewayHandler.service();
        }
    }

    /**
     * 设置下一个GateWayHandler
     *
     * @param gatewayhandler
     */
    public void setNextGatewayhandler(GatewayHandler gatewayhandler) {
        this.nextGatewayHandler = gatewayhandler;
    }
}
